txt 2 re
        headache relief for programmers :: regular expression generator         (perl php python java javascript coldfusion c c++ ruby vb vbscript j# c# c++.net vb.net)
 
Enter the string that you want to use a regular expression on:
1
   
 
Select the elements that you want to extract to run regular expression generator:
2
0
c 0
d0
8
c 8
d8
day08
int08
:
c :
M
c M
wM
a
c a
wa
y
c y
wy
varMay
wordMay
month
:
c :
2
c 2
d2
0
c 0
d0
0
c 0
d0
8
c 8
d8
day08
year2008
int2008
ddmmmyyyy08:May:2008
_
c _
ws_
"
c "
T
c T
wT
h
c h
wh
i
c i
wi
s
c s
ws
varThis
wordThis
_
c 
ws_
i
c i
wi
s
c s
ws
varis
wordis
_
c _
ws_
a
c a
wa
n
c n
wn
varan
wordan
_
c _
ws_
E
c E
wE
x
c x
wx
a
c a
wa
m
c m
wm
p
c p
wp
l
c l
wl
e
c e
we
varExample
wordExample
!
c !
"
c "
string"This_is_an_Example!"
< Source String
What to click?  extract any integer in this position
extract this integer (2006) in this position
 
3Perl regular expression program that extracts the selected elements from the entered string:
[Perl] PHP Python Java Javascript ColdFusion C C++ Ruby VB VBScript J#.net C#.net C++.net VB.net 
 
#!/usr/bin/perl

# URL that generated this code:
# http://www.txt2re.com/index.php3?s=08:May:2008%20"This%20is%20an%20Example!"&9&48

$txt='08:May:2008 "This is an Example!"';

$re1='.*?';	# Non-greedy match on filler
$re2='((?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Sept|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?))';	# Month 1
$re3='.*?';	# Non-greedy match on filler
$re4='.';	# Uninteresting: c
$re5='.*?';	# Non-greedy match on filler
$re6='.';	# Uninteresting: c
$re7='.*?';	# Non-greedy match on filler
$re8='.';	# Uninteresting: c
$re9='.*?';	# Non-greedy match on filler
$re10='.';	# Uninteresting: c
$re11='.*?';	# Non-greedy match on filler
$re12='.';	# Uninteresting: c
$re13='.*?';	# Non-greedy match on filler
$re14='.';	# Uninteresting: c
$re15='.*?';	# Non-greedy match on filler
$re16='.';	# Uninteresting: c
$re17='.*?';	# Non-greedy match on filler
$re18='.';	# Uninteresting: c
$re19='.*?';	# Non-greedy match on filler
$re20='.';	# Uninteresting: c
$re21='.*?';	# Non-greedy match on filler
$re22='.';	# Uninteresting: c
$re23='.*?';	# Non-greedy match on filler
$re24='.';	# Uninteresting: c
$re25='.*?';	# Non-greedy match on filler
$re26='(.)';	# Any Single Character 1

$re=$re1.$re2.$re3.$re4.$re5.$re6.$re7.$re8.$re9.$re10.$re11.$re12.$re13.$re14.$re15.$re16.$re17.$re18.$re19.$re20.$re21.$re22.$re23.$re24.$re25.$re26;
if ($txt =~ m/$re/is)
{
    $month1=$1;
    $c1=$2;
    print "($month1) ($c1) \n";
}

#-----
# Paste the code into a new perl file. Then in Unix:
# $ perl x.pl 
#-----
plain text version of code
 
 
 
 
Feedback
Lonely girl:: I love you.Thu, 5 Aug 2010 10:46AM
:: i dot understand this lolzThu, 5 Aug 2010 12:12PM
anonx174:: You should receive an award for this website. Seriously.Mon, 9 Aug 2010 11:22PM
cuono:: I present to you the ultimate award for helping mankind. It is guilded in gold or platinum and exists somewhere near Betelgeuse. Thanks for the great tool!Wed, 11 Aug 2010 09:12PM
Lonely boy:: I love you too Lonely girlThu, 12 Aug 2010 08:19AM
coder:: you lols - stuped toolThu, 12 Aug 2010 12:17PM
fan boy:: OMG OMG OMG OMG OMGFri, 13 Aug 2010 02:55AM
Alex:: thank you so much! i agree on the "ultimate award for helping mankind".Sat, 14 Aug 2010 02:28AM
outime:: Best tool in the world. Would be f****** awesome if you make it open-source to have it stored locally (offline)Sat, 14 Aug 2010 04:06AM
paul:: this site is the best site on earth!!!!!!!!!!!!!!!!!!!!!!!!!!Sat, 14 Aug 2010 08:53AM
ClusterOne:: wow, very helpful ... awsome!Sat, 14 Aug 2010 07:30PM
jkFF:: badly need this thanks!!! great job!!!Mon, 16 Aug 2010 07:08AM
ericlee:: amazingMon, 16 Aug 2010 08:05AM
Chris:: Awesome, thanks!Tue, 17 Aug 2010 03:55PM
Hendra:: Subhanallah, amazing.... Great job...!!!Tue, 17 Aug 2010 05:06PM
pdh:: amazing, saved me a bunch of time on tedious matchesWed, 18 Aug 2010 06:34PM
RubyFan:: Love thisThu, 19 Aug 2010 03:35PM
12 years old:: I'm 12 and what is this?Thu, 19 Aug 2010 08:45PM
Props:: thank you guys for keeping the headache out of my brain !Fri, 20 Aug 2010 02:08PM
mark:: yup really a wonderfull tool!Mon, 23 Aug 2010 01:00PM
py:: very thx for your website it's very helpfulTue, 24 Aug 2010 05:24PM
wrathtaker:: wahaw!!!!!Wed, 25 Aug 2010 07:10PM
bradyboy:: just amazingThu, 26 Aug 2010 03:47PM
george n.:: Thats amazing man, very very usefulThu, 26 Aug 2010 07:33PM
Zorro:: You saved me. You deserve a bawlz energy drink.Thu, 26 Aug 2010 11:14PM
kamm:: Thanks for sharing this with the world :)Fri, 27 Aug 2010 12:01PM
Kavinsky:: The best tool i found this year!Fri, 27 Aug 2010 06:10PM
yo yo:: life-saver, innt'it?Sun, 29 Aug 2010 06:09PM
xxiyxhmrf:: BXoRwCDVQQtWSckSun, 29 Aug 2010 07:50PM
chromosome (\d+|\w+)::  Mon, 30 Aug 2010 10:34AM
:: cocksTue, 31 Aug 2010 05:42AM
:: You should definitly make an offline version of this, Great stuff!!Tue, 31 Aug 2010 01:22PM
:: Thanks so much, if there would be a donate Button, I would donate!Tue, 31 Aug 2010 06:21PM
dique:: cock headsWed, 1 Sep 2010 12:48AM
mrithu:: nice !if php preg_match used it will be more helpfulWed, 1 Sep 2010 01:50PM
Wander:: Great one!Thu, 2 Sep 2010 08:16AM
fsd:: fsdfThu, 2 Sep 2010 11:36AM
FF:: One of the most useful regex tools I have seen to date.Thu, 2 Sep 2010 08:22PM
Alex:: complete godsend, thank you! lol win.Fri, 3 Sep 2010 11:55AM
bigwwi:: JIgLUOfEKavnQQFri, 3 Sep 2010 01:06PM
Thanks!:: >_< to easySun, 5 Sep 2010 06:26AM
::  Mon, 6 Sep 2010 06:21AM
::  Mon, 6 Sep 2010 06:26AM
yiran:: very useful tool, thanksMon, 6 Sep 2010 07:34AM
 
  home     faq